<script setup lang="ts">
import { inject, type Ref } from 'vue'

const money = inject<Ref<number>>('money')
const payMoney = inject<(value: number) => void>('payMoney')!
</script>

<template>
  <div class="box">
    孙子组件 爷爷的钱包: {{ money }}
    <button @click="payMoney(100)">花爷爷的钱</button>
  </div>
</template>

<style scoped>
.box {
  width: 300px;
  height: 300px;
  border: 10px solid #000;
}
</style>
